package com.autosalon.model;

import java.io.Serializable;
import java.sql.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * @author tomas
 *
 */
@Entity
@Table(name = "POISTENI")
public class Poisteni implements Serializable, IModelClass{
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	
	@Column(name = "POC_DATUM", nullable = false)
	private Date pocDatum;
	
	@Column(name = "KON_DATUM", nullable = false)
	private Date konDatum;
	

	
	@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
	@JoinColumn(name = "ID_POISTOVNY")
	private Poistovna poistovna;
	
	@OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE,CascadeType.REFRESH})
	@JoinColumn(name = "ID_POISTENI")
	private List<Objednavka> objednavky;

	@Override
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getPocDatum() {
		return pocDatum;
	}

	public void setPocDatum(Date pocDatum) {
		this.pocDatum = pocDatum;
	}

	public Date getKonDatum() {
		return konDatum;
	}

	public void setKonDatum(Date konDatum) {
		this.konDatum = konDatum;
	}



	public Poistovna getPoistovna() {
		return poistovna;
	}

	public void setPoistovna(Poistovna poistovna) {
		this.poistovna = poistovna;
	}

	public List<Objednavka> getObjednavky() {
		return objednavky;
	}

	public void setObjednavky(List<Objednavka> objednavky) {
		this.objednavky = objednavky;
	}
	
	

}
